<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<div class="row">
	<div class="col-md-12 col-sm-12 col-lg-12 col-xs-12 text-right">
		<t-auth:roleButton />
	</div>
</div>
<script type="text/javascript">
function addData(){
	top.openModal("/billing/returnOfCargo/addDetailed?type="+"add","returnOfCargo_form","退货单-添加",1100,552);
}

function editData(){
	var id=getKeyId();
	if(isEditor(id)){
		top.openModal("/billing/returnOfCargo/detailed?key="+id+"&type="+"modify","returnOfCargo_form","退货单-修改",1100,552);
	}
}

function selData(){
	var key=getKeyId();
	if(isEditor(key)){
		top.openModal("/billing/returnOfCargo/detailed?key="+key+"&type="+"check","returnOfCargo_form","退货单-查看",1100,552);
	
	}
}
function addPay(){
	var id=getKeyId();
	if(isEditor(id)){
		top.openModal("/billing/billing/addPayDetailed?key="+id+"&paymentState="+"refund","returnOfCargo_form","退款详情",650,300);
	}
}


function printer(){
	var id=getKeyId();
	if(isEditor(id)){
		top.openModal("/billing/returnOfCargo/detailedPrint?key="+id,"billing_form","付款详情",1100,552);
	}
}


function billingClose(){
	var id=getKeyId();
	if(isEditor(id)){
		var url = $.getVirtualPath()+"/billing/billing/checkBillingState?key="+id;
        var msg =  $.getText(url);
    	if("banClose"==msg){
       		$.showTips("此订单不允许作废！",1000,"warning");
       	}else{
       		confirm("是否作废订单？",function(result){
    			if(result){
    				var url = $.getVirtualPath()+"/billing/billing/closeBillingByKey";
    			    var msg =  $.getJsonPost(url,"key="+id);
    			    $.showTips(msg.message,1000,msg.resultType);
    			    formSubmit();
    			}
    		});
       	}
	}
}

function check(){
	var confirm=$(".cntable.table>tbody>tr.select-tr").attr("data-confirm");
	var id=getKeyId();
	if(confirm=="checked"){
		$.showTips("此订单已审核！",1000,"warning");
	}else{
		if(isEditor(id)){
			top.openModal("/billing/billing/checkDetailed?key="+id+"&type="+"modify"+"&openLocation="+"returnOfCargo","billing_form","退货单详情-审核",1100,552);
		}
	}

}

function exportMaterialAll(){
	var id=getKeyId();
	if(isEditor(id)){
		var url = $.getVirtualPath()+"/billing/billing/exportDetailed?key="+id;
		window.open(url);
	}

}
</script>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/notifications.jsp"%>
